<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机点名系统</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            font-family: 'Microsoft YaHei', sans-serif;
        }

        .container {
            text-align: center;
            background: rgba(255, 255, 255, 0.95);
            padding: 3rem;
            border-radius: 20px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            width: 90%;
            max-width: 600px;
        }

        h1 {
            color: #2c3e50;
            margin-bottom: 2rem;
            font-size: 2.5rem;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
        }

        .name-display {
            font-size: 3.5rem;
            margin: 2.5rem 0;
            color: #34495e;
            min-height: 120px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #f8f9fa;
            border-radius: 15px;
            padding: 1.5rem;
            box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.1);
            transition: all 0.3s;
        }

        .btn {
            padding: 1.2rem 2.5rem;
            font-size: 1.3rem;
            border: none;
            border-radius: 30px;
            cursor: pointer;
            background: #4CAF50;
            color: white;
            transition: all 0.3s;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin: 0 0.5rem;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }

        .btn.stop {
            background: #ff4757;
        }

        .rolling {
            animation: shake 0.1s infinite;
            color: #e74c3c;
        }

        @keyframes shake {
            0% {
                transform: translateX(-2px);
            }

            50% {
                transform: translateX(2px);
            }

            100% {
                transform: translateX(-2px);
            }
        }

        @media (max-width: 480px) {
            .container {
                padding: 2rem;
            }

            h1 {
                font-size: 2rem;
            }

            .name-display {
                font-size: 2.5rem;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <h1>🎉 随机点名系统</h1>
        <div id="display" class="name-display">准 备 就 绪</div>
        <button id="actionBtn" class="btn">开 始</button>
    </div>

    <script>
        let students = [
            { "学号": "2313030110", "姓名": "谭都都", "积分": 0 },
            { "学号": "2313030133", "姓名": "卢云龙", "积分": 1 },
            { "学号": "2313030119", "姓名": "黄萍", "积分": 0 },
            { "学号": "2313030131", "姓名": "张佳怡", "积分": 4 },
            { "学号": "2313030123", "姓名": "汪灵蕊", "积分": 0 },
            { "学号": "2313030111", "姓名": "李佳琪", "积分": 3 },
            { "学号": "2313030115", "姓名": "柯友南", "积分": 4 },
            { "学号": "2313030126", "姓名": "丁嘉伟", "积分": 3 },
            { "学号": "2313030116", "姓名": "高赢", "积分": 0 },
            { "学号": "2313030128", "姓名": "喻文龙", "积分": 1 },
            { "学号": "2313030127", "姓名": "王思杰", "积分": 0 },
            { "学号": "2313030125", "姓名": "吴一凡", "积分": 1.5 },
            { "学号": "2313030101", "姓名": "娄梓瑜", "积分": 0.5 },
            { "学号": "2313030105", "姓名": "吴阳", "积分": 0.5 },
            { "学号": "2313030122", "姓名": "王超群", "积分": 4 },
            { "学号": "2313030112", "姓名": "操凯灵", "积分": 1 },
            { "学号": "2313030104", "姓名": "杨丹", "积分": 0 },
            { "学号": "2313030108", "姓名": "胡娜", "积分": 0 },
        ]

        let isRunning = false;
        let intervalId = null;
        const display = document.getElementById('display');
        const actionBtn = document.getElementById('actionBtn');

        function getRandomStudent() {
            return students[Math.floor(Math.random() * students.length)];
        }

        actionBtn.addEventListener('click', function () {
            if (isRunning) {
                // 停止抽选
                clearInterval(intervalId);
                isRunning = false;
                actionBtn.textContent = '开 始';
                actionBtn.classList.remove('stop');
                display.classList.remove('rolling');
            } else {
                // 开始抽选
                isRunning = true;
                actionBtn.textContent = '停 止';
                actionBtn.classList.add('stop');
                display.classList.add('rolling');

                intervalId = setInterval(() => {
                    display.textContent = getRandomStudent();
                }, 50);
            }
        });
    </script>
</body>

</html>